package com.hiwhitley.himei.contract.model;

import com.hiwhitley.himei.contract.GameDetailContract;
import com.hiwhitley.himei.entity.Game;
import com.hiwhitley.himei.entity.ScreenItem;
import com.hiwhitley.himei.entity.GameScreenHorizontal;
import com.hiwhitley.himei.entity.GameScreenVertical;
import com.hiwhitley.himei.network.RetrofitFactory;
import com.hiwhitley.himei.network.service.GameService;

import rx.Observable;

/**
 * Created by hiwhitley on 2016/10/11.
 */

public class GameDetailModel implements GameDetailContract.Model {
    private static final String TAG = "GameDetailModel";
    private static GameService sGameService;

    public GameDetailModel() {
        sGameService = RetrofitFactory.getGameService();
    }


    @Override
    public Observable<Game> getGameDetail(int gid) {
        return sGameService.getGameDetail(gid);
    }

    public static ScreenItem parseDataByType(Game.Screens screens, boolean isVertical) {
        if (isVertical)
            return new GameScreenVertical()
                    .setScreens(screens);
        return new GameScreenHorizontal()
                .setScreens(screens);
    }
}
